//
//  YSThemeCell.m
//  YSBookRead
//
//  Created by MOLBASE on 2018/11/14.
//  Copyright © 2018年 YangShen. All rights reserved.
//

#import "YSThemeCell.h"
#import "Masonry.h"

@interface YSThemeCell ()

@end

@implementation YSThemeCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupSubViews];
    }
    return self;
}

- (void)setupSubViews {
    self.themeImageView = [[UIImageView alloc] init];
    [self addSubview:self.themeImageView];
    self.themeImageView.layer.cornerRadius = 20;
    self.themeImageView.layer.masksToBounds = YES;
    [self.themeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_offset(UIEdgeInsetsZero);
    }];

    self.selectImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"setting_theme_selected"]];
    [self addSubview:self.selectImageView];
    [self.selectImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_offset(UIEdgeInsetsZero);
    }];

    [self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapEvent)]];
}

- (void)tapEvent {
    !self.selectBlock ?: self.selectBlock();
}

@end
